// 类型管理
import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";

type allProductResult = {
  success: boolean;
  data?: {
    /** 列表数据 */
    records: Array<any>;
    /** 总条目数 */
    total?: number;
    /** 每页显示条目个数 */
    size?: number;
    /** 当前页数 */
    current?: number;
  };
};
export type addProductResult = {
  code: any;
  msg: Array<any>;
  data?: Array<any>;
};

// 获取所有类型类型
export const getAllProductList = (data?: object) => {
  return http.request<allProductResult>(
    "post",
    baseUrlApi("consumer/productCategory/selectYkProductCategoryLimit"),
    {
      data
    }
  );
};
// 添加类型
export const addProduct = (data?: object) => {
  return http.request<addProductResult>(
    "post",
    baseUrlApi("consumer/productCategory/add"),
    {
      data
    }
  );
};

// 修改类型
export const updateProduct = (data?: object) => {
  return http.request<addProductResult>(
    "post",
    baseUrlApi("consumer/productCategory/update"),
    {
      data
    }
  );
};

// 删除类型
export const deleteProduct = (data?: object) => {
  return http.request<addProductResult>(
    "post",
    baseUrlApi("consumer/productCategory/delete"),
    {
      data
    }
  );
};
